<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Welcome to CherryPyLucene’s documentation! &mdash; CherryPyLucene v0.1a0 documentation</title>
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '0.1a0',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="CherryPyLucene v0.1a0 documentation" href="" />
    <link rel="next" title="engine" href="engine.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="modindex.html" title="Global Module Index"
             accesskey="M">modules</a> |</li>
        <li class="right" >
          <a href="engine.html" title="engine"
             accesskey="N">next</a> |</li>
        <li><a href="">CherryPyLucene v0.1a0 documentation</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="welcome-to-cherrypylucene-s-documentation">
<h1>Welcome to CherryPyLucene&#8217;s documentation!<a class="headerlink" href="#welcome-to-cherrypylucene-s-documentation" title="Permalink to this headline">¶</a></h1>
<dl class="docutils">
<dt><a class="reference external" href="http://code.google.com/p/cherrypylucene/">CherryPyLucene</a> provides:</dt>
<dd><ul class="first last simple">
<li>high-level Pythonic search <a class="reference external" href="engine.html">engine</a> interface to <a class="reference external" href="http://lucene.apache.org/pylucene/">PyLucene</a></li>
<li><a class="reference external" href="http://en.wikipedia.org/wiki/Representational_State_Transfer">RESTful</a> <a class="reference external" href="http://json.org/">JSON</a> <a class="reference external" href="http://cherrypy.org/">CherryPy</a> <a class="reference external" href="server.html">server</a></li>
<li>simple Python <a class="reference external" href="client.html">client</a> for interacting with the server</li>
</ul>
</dd>
</dl>
<p>Quickstart:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">cherrypylucene</span> <span class="kn">import</span> <span class="n">engine</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">indexer</span> <span class="o">=</span> <span class="n">engine</span><span class="o">.</span><span class="n">Indexer</span><span class="p">()</span>                      <span class="c"># create an in-memory index (no filename supplied)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">indexer</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s">&#39;name&#39;</span><span class="p">,</span> <span class="n">store</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>                 <span class="c"># create stored &#39;name&#39; field</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">indexer</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s">&#39;text&#39;</span><span class="p">)</span>                             <span class="c"># create indexed &#39;text&#39; field (the default)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">indexer</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s">&#39;sample&#39;</span><span class="p">,</span> <span class="n">text</span><span class="o">=</span><span class="s">&#39;hello world&#39;</span><span class="p">)</span>  <span class="c"># add a document to the index</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">indexer</span><span class="o">.</span><span class="n">commit</span><span class="p">()</span>                                <span class="c"># commit changes; document is now searchable</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">hits</span> <span class="o">=</span> <span class="n">indexer</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="s">&#39;text:hello&#39;</span><span class="p">)</span>             <span class="c"># run search and return sequence of documents</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">len</span><span class="p">(</span><span class="n">hits</span><span class="p">),</span> <span class="n">hits</span><span class="o">.</span><span class="n">count</span>                           <span class="c"># 1 hit retrieved (out of a total of 1)</span>
<span class="go">(1, 1)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">hit</span><span class="p">,</span> <span class="o">=</span> <span class="n">hits</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">hit</span><span class="p">[</span><span class="s">&#39;name&#39;</span><span class="p">]</span>                                     <span class="c"># hits support mapping interface for their stored fields</span>
<span class="go">u&#39;sample&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">hit</span><span class="o">.</span><span class="n">id</span><span class="p">,</span> <span class="n">hit</span><span class="o">.</span><span class="n">score</span>                               <span class="c"># plus internal doc number and score</span>
<span class="go">(0, 0.19178301095962524)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">hit</span><span class="o">.</span><span class="n">dict</span><span class="p">()</span>                                      <span class="c"># dict representation of the hit document</span>
<span class="go">{&#39;__score__&#39;: 0.19178301095962524, u&#39;name&#39;: u&#39;sample&#39;, &#39;__id__&#39;: 0}</span>
</pre></div>
</div>
<p>Contents:</p>
<ul>
<li class="toctree-l1"><a class="reference external" href="engine.html">engine</a><ul>
<li class="toctree-l2"><a class="reference external" href="engine.html#module-engine.indexers">indexers</a></li>
<li class="toctree-l2"><a class="reference external" href="engine.html#module-engine.documents">documents</a></li>
<li class="toctree-l2"><a class="reference external" href="engine.html#module-engine.queries">queries</a></li>
<li class="toctree-l2"><a class="reference external" href="engine.html#module-engine.spatial">spatial</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference external" href="server.html">server</a><ul>
<li class="toctree-l2"><a class="reference external" href="server.html#root">Root</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference external" href="client.html">client</a><ul>
<li class="toctree-l2"><a class="reference external" href="client.html#resource">Resource</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="indices-and-tables">
<h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Permalink to this headline">¶</a></h1>
<ul class="simple">
<li><a class="reference external" href="genindex.html"><em>Index</em></a></li>
<li><a class="reference external" href="modindex.html"><em>Module Index</em></a></li>
<li><a class="reference external" href="search.html"><em>Search Page</em></a></li>
</ul>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h3><a href="">Table Of Contents</a></h3>
            <ul>
<li><a class="reference external" href="">Welcome to CherryPyLucene&#8217;s documentation!</a><ul>
</ul>
</li>
<li><a class="reference external" href="#indices-and-tables">Indices and tables</a></li>
</ul>

            <h4>Next topic</h4>
            <p class="topless"><a href="engine.html"
                                  title="next chapter">engine</a></p>
            <h3>This Page</h3>
            <ul class="this-page-menu">
              <li><a href="_sources/index.txt"
                     rel="nofollow">Show Source</a></li>
            </ul>
          <div id="searchbox" style="display: none">
            <h3>Quick search</h3>
              <form class="search" action="search.html" method="get">
                <input type="text" name="q" size="18" />
                <input type="submit" value="Go" />
                <input type="hidden" name="check_keywords" value="yes" />
                <input type="hidden" name="area" value="default" />
              </form>
              <p class="searchtip" style="font-size: 90%">
              Enter search terms or a module, class or function name.
              </p>
          </div>
          <script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="modindex.html" title="Global Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="engine.html" title="engine"
             >next</a> |</li>
        <li><a href="">CherryPyLucene v0.1a0 documentation</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
      &copy; Copyright 2009, Aric Coady.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.1.
    </div>
  </body>
</html>